<template>
	<view>
		<view class="blog-list-container">
			<view class="blog-item-container" v-for="item in blogList" :key="item.blogId" @click="toBlogInfo(item.blogId)">
				<image class="blog-image" :src="item.blogImage"></image>
				<view class="blog-item">
					<view class="blog-content">
						{{item.blogTitle}}
					</view>
					<view class="blog-meta-container">
						<view class="blog-meta">
							<image class="blog-meta-icon" src="/static/icons/shijian.png"></image>
							<text class="blog-meta-text">{{item.createdTime }}</text>
						</view>
						<view class="blog-meta">
							<image class="blog-meta-icon" src="/static/icons/yuedu.png"></image>
							<text class="blog-meta-text">{{item.blogRead }}</text>
						</view>
						<view class="blog-meta">
							<image class="blog-meta-icon" src="/static/icons/dianzan.png"></image>
							<text class="blog-meta-text">{{item.blogGoods}}</text>
						</view>
						<view class="blog-meta">
							<image class="blog-meta-icon" src="/static/icons/huifu.png"></image>
							<text class="blog-meta-text">{{item.blogComment}}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			};
		},
		props:['blogList'],
		filters: {
			parseTimeToDate(time) {
				// 将时间字符串转换为日期字符串
				if(time) {
					return time.split(' ')[0]
				}
				return ''
			}
		},
		methods: {
			toBlogInfo(id) {
				uni.navigateTo({
					url:`../../pages/blog-info/blog-info?id=${id}`
				})
			}
		}
	}
</script>

<style>
@import url('./index.css')
</style>
